﻿@using EasyWeb.Services
@model EWText
@{
    var collection = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

    if (Model != null)
    {
        foreach (var value in Model.Values.OrderBy(v => v.Name))
        {
            collection.Add(value.Name, value.Text);
        }
    }

    foreach (var item in ((IEWCultureService)EWServiceProviderManager.ServiceProvider.GetService(typeof(IEWCultureService))).All.OrderBy(c => c.Culture.Name))
    {
        var name = item.Culture.Name;
        if (!collection.ContainsKey(name))
        {
            collection.Add(name, null);
        }
    }
}
<div class="easyweb-ewtext">
    @Html.HiddenFor(m => m)
    <table class="ui-widget ui-helper-reset easyweb-ewsimple">
        <thead class="ui-helper-reset ui-widget-content">
            <tr>
                <th style="width: 3em;">@EWWebResources.EWText_GridTitle_Lcid</th>
                <th style="width: 10em;">@EWWebResources.EWText_GridTitle_Name</th>
                <th style="width: 10em;">@EWWebResources.EWText_GridTitle_NativeName</th>
                <th style="width: 20em;">@EWWebResources.EWText_GridTitle_EnglishName</th>
                <th>@EWWebResources.EWText_GridTitle_LocalizedText</th>
            </tr>
        </thead>
        <tbody class="ui-helper-reset ui-widget-content">
            @{
                foreach (var item in collection)
                {
                    var culture = CultureInfo.GetCultureInfo(item.Key);
                <tr>
                    <td style="width: 3em;">@culture.LCID</td>
                    <td style="width: 10em;">@culture.Name</td>
                    <td style="width: 10em;">@culture.NativeName</td>
                    <td style="width: 20em;">@culture.DisplayName</td>
                    <td><textarea rows="1" cols="0">@item.Value</textarea></td>
                </tr>
                }
            }
        </tbody>
    </table>
</div>
